import {url, Post, Get, GetAndHeaders, PostAndHeaders} from './api'

const myLale = "/sys"
const urlList = {
  login: url + myLale + "/user/login",
  userBytokenApi: url + myLale + "/user/getUserByToken",
  userUpdate: url + myLale + "/user/update",
  getUserProgressBars: url + myLale + "/user/getUserProgressBars",
  listUserByPhoneOrName: url + myLale + "/friend/listUserByPhoneOrName",
  listFriendByMe: url + myLale + "/friend/listFriendByMe",
  get: url + myLale + "/user/get",
  listAddFriend: url + myLale + "/friend/listAddFriend",
  countUser: url + myLale + "/user/countUser",
  listChatByFromUser: url + myLale + "/friend/listChatByFromUser",
  listChatByToken: url + myLale + "/friend/listChatByToken",
  updatePas: url + myLale + "/user/updatePas",
  getFriendByFromId: url + myLale + "/friend/getFriendByFromId",
  updateFriend: url + myLale + "/friend/updateFriend",
  deleteFriend: url + myLale + "/friend/deleteFriend"
}

//通过用户id获取用户信息
export function get(params) {
  return Get(urlList.get, params);

}

//登录接口
export function loginapi(data) {
  return Post(urlList.login, data);
}

//获取用户信息通过token
export function getUserBytokenApi(params, headers) {
  return GetAndHeaders(urlList.userBytokenApi, params, headers)
}

//修改用户信息
export function updateUser(data, headers) {
  return PostAndHeaders(urlList.userUpdate, data, headers)
}

//返回当前用户人生进度条
export function getUserProgressBars(headers) {
  return GetAndHeaders(urlList.getUserProgressBars, {}, headers)
}

//通过条件查找好友
export function listUserByPhoneOrName(params, headers) {
  return GetAndHeaders(urlList.listUserByPhoneOrName, params, headers)
}

//返回当前用户好友列表
export function listFriendByMe(headers) {
  return GetAndHeaders(urlList.listFriendByMe, {}, headers)
}

//返回当前用户的好友申请列表
export function listAddFriend(headers) {
  return GetAndHeaders(urlList.listAddFriend, {}, headers)
}

//返回用户的资源数量
export function countUser(headers) {
  return GetAndHeaders(urlList.countUser, {}, headers)
}

//返回目标用户和当前用户的所有聊天记录
export function listChatByFromUser(params, headers) {
  return GetAndHeaders(urlList.listChatByFromUser, params, headers)
}

//返回最近和当前用户有聊天的记录列表
export function listChatByToken(headers) {
  return GetAndHeaders(urlList.listChatByToken, {}, headers)
}

//修改密码
export function updatePas(data, headers) {
  return PostAndHeaders(urlList.updatePas, data, headers)
}

//通过用户id和本人id获取到好友信息
export function getFriendByFromId(params, headers) {
  return GetAndHeaders(urlList.getFriendByFromId, params, headers)
}


//修改用户权限
export function updateFriend(data, headers) {
  return PostAndHeaders(urlList.updateFriend, data, headers)
}

//删除好友
export function deleteFriend(params, headers) {
  return GetAndHeaders(urlList.deleteFriend, params, headers)
}



